/*
 * Copyright 2011 Marcos Fabio Pereira
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package com.moveme.network.payload.state;

import java.nio.ByteBuffer;

/**
 * Move image state
 * 
 * @author Marcos Fabio Pereira
 *
 */
public class PSMoveImageState {
    public final long frameTimestamp;
    
    public final long timestamp;
    
    public final float u;
    
    public final float v;
    
    public final float r;
    
    public final float projectionx;
    
    public final float projectiony;
    
    public final float distance;
    
    public byte visible;
    
    public byte rValid;
    
    public PSMoveImageState(ByteBuffer byteBuffer, int idMoveController) {
        int offset = 808 + idMoveController * 48;
        frameTimestamp = byteBuffer.getLong(offset);
        timestamp = byteBuffer.getLong(offset + 8);
        u = byteBuffer.getFloat(offset + 16);
        v = byteBuffer.getFloat(offset + 20);
        r = byteBuffer.getFloat(offset + 24);
        projectionx = byteBuffer.getFloat(offset + 28);
        projectiony = byteBuffer.getFloat(offset + 32);
        distance = byteBuffer.getFloat(offset + 36);
        visible = byteBuffer.get(offset + 40);
        rValid = byteBuffer.get(offset + 31);
    }
    
}
